package algorithm;

public class leetcode_0300 {
    public int lengthOfLIS(int[] nums) {
        int len=nums.length;
        int[] dp=new int[len];
        for(int i=0;i<len;++i) dp[i]=1;
        for(int i=1;i<len;++i){
            for(int j=0;j<i;++j){
                if(nums[j]<nums[i]){
                    dp[i]=(dp[i]>dp[j]+1)?dp[i]:(dp[j]+1);
                }
            }
        }
        int max=1;
        for(int i=0;i<len;++i){
            max=(max>dp[i])?max:dp[i];
        }
        return max;
    }
}
